(PS: Latest Progress-& amp; gt; I failed to call the File Upload class library, that is, I $ this-& amp; gt; load-& amp; gt; library (& #039; upload & #039;, $ cofig) The problem occurs here. You can echo a sentence before this sentence, and then
Thinkphp uploads an image of a product Using AJAX to prevent the upload of the product from being canceled. Then, the image is saved in a zero-time table, I want to create a hook to automatically delete temporary images when the SESSION ends. What
Let's start with a simple one:
Copy the Code code as follows:
Http://www.jb51.netClass upload{Public $length; Limit file Sizepublic $file; Determine if this class is for image upload or file uploadPublic $fileName; FilenamePublic $fileTemp;
For example, a user must upload an image before sending a post (the file is stored on a third-party platform such as qiniu, and a record will be written into the database after the user uploads the post ), when the user uploads an image, the user
thinkphp Upload a picture of the product with the Ajax pass, to prevent the mid-way to cancel the product upload, and then the picture with a zero table saved, I want to do a hook at the end of the session automatically delete the temporary image to
Php image upload code. Let's make it simple: Copy the code as follows :? Www. jb51.netclassupLoad {public $ length; the file size is limited to public $ file; it is easy to determine whether this class is used for image upload or file upload:
The
PHP image upload class; support for watermark-date folder-generating thumbnails; support for multifile Upload
You can use {Y} {m} {n} to change the current date.
Set_dir (dirname (_ FILE __). '/upload/', '{y}/{m}'); // save path.
PHP implementation of image upload and replace the operation,
Create two files first: change.html and change.php
The form code for the change.html file is as follows:
Change file example.
Here are a few things to pay attention to, first look
After the UE editor is deployed to the server, the uploaded image shows that the temporary file cannot be found. The error is combined with the network resource and the cause is: Configure php. ini; upload_tmp_dir = "C:/upload/temp", that is, the
You can use {Y}{m}{n} to become the current date
Set_dir (DirName (__file__). ' /upload/', ' {y}/{m} '); Save path, support {y}{m}{d} these several options
$up->set_thumb (100,80); Thumbnail size setting. Units in pixels
$up->set_
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.